package org.example.DesignPatterns.Strategy;

/**
 * @description:
 * @author: farprt
 * @create: 2022-03-09 22:16
 **/
public class CashContext {
    private CashSuper cashSuper;

    public CashContext(String type) {
        switch (type){
            case "正常收费":
                CashSuper cashNormal=new CashNormal();
                cashSuper=cashNormal;
                break;
            case "满300反100":
                CashSuper cashReturn=new CashReturn("300","100");
                cashSuper=cashReturn;
                break;
            case "打8折":
                CashSuper cashRebate=new CashRebate("0.8");
                cashSuper=cashRebate;
                break;
        }
    }

    public double GetResult(Double money){
        return cashSuper.acceptCash(money);
    }


}